/**
 * 2
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 24-10-18 下午6:48
 */

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> nums(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> nums[i];
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (nums[i] == i) {
            res++;
            if (i < n && nums[i + 1] == i + 1) {
                i++;
            }
        }
    }
    cout << res;
    return 0;
}